import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import com.rshacking.rhf.files.JarContainer;
import com.rshacking.rhf.updater.Updater;

public class RunUpdater {

	private Updater updater;

	public void runUpdater() {
		updater.execute();
	}

	public void printLog() {
		System.out.println("My awesome new updater!");
		System.out.println("-------------------------\n");
		System.out.print(updater.log());
	}

	public void saveInjected(String path) {
		updater.injectGetters();
		updater.getJar().save(new File(path));
	}

	public RunUpdater() {
		try {
			JarContainer jar = new JarContainer(new URL(
					"http://world1.runescape.com/runescape.jar"));
			updater = new Updater(jar);
			updater.setPackage("hooks");
			/*updater.addTransform(new SignLinkTransform());
			updater.addTransform(new InterfaceTransform());
			updater.addTransform(new ClientTransforms());
			updater.addTransform(new NPCTransform());*/
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		RunUpdater runUpdater = new RunUpdater();
		runUpdater.runUpdater();
		runUpdater.printLog();
		// runUpdater.saveInjected("injected_client.jar");
	}

}